/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package phan.connection;

import java.util.Calendar;
import java.text.SimpleDateFormat;

/**
 *
 * @author BAILLEURS SERVICES
 */
public class GenererCommand {

    public static final String MONTH_YEAR = "MMyy";
    public static final String HOUR_MIN_SEC = "hhmmss";
    public static final String MONTH = "MM";
    private String numeroCommand;

    public GenererCommand() {

        numeroCommand = "";
    }

    public String NumeroCommand(String id) {

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(MONTH_YEAR);
        SimpleDateFormat sdf1 = new SimpleDateFormat(MONTH);
        


        String COM = "";
        COM = sdf.format(cal.getTime());
        
        int n=Integer.parseInt(sdf1.format(cal.getTime()));
        int n1=12-n;

        if(n1<10){
            COM +="0"+n1;
        }
        if(n1>=10){
            COM +=n1;
        }
       

        for (int i = 1; i <= 8 - id.length(); i++) {
            COM = COM + 0;
        }
        COM = COM + id;
        return COM;
    }

    /**
     * @return the numeroCommand
     */
    public String getNumeroCommand() {
        return numeroCommand;
    }

    /**
     * @param numeroCommand the numeroCommand to set
     */
    public void setNumeroCommand(String numeroCommand) {
        this.numeroCommand = numeroCommand;
    }

    public static void main(String[] args) {

        GenererCommand com = new GenererCommand();
       
        

        

        System.out.print("COMMMAND :" + com.NumeroCommand("1111"));
        String le = com.NumeroCommand("111");
        System.out.print("\n String length :" + le.length());


    }
}
